package lab01;

public class Test05 {
    public static void main(String[] args) {
        //定义并初始化变量
        int i = 0;
        int j = 0;
        int m = 0;
        int sum1 = 0;
        int sum2 = 0;
        int sum3 = 0;

        //for循环求和。
        for (; i <= 100; i++) {
            sum1 = sum1 + i;
        }
        System.out.println(sum1); //求1-100的和

        //while循环求和
        while (j < 100) {
            j++;
            sum2 = sum2 + j;
        }
        System.out.println(sum2);

        //do while循环求和
        do {
            m++;
            sum3 = sum3 + m;
        } while (m < 100);
        System.out.println(sum3);

    }

}
